import java.util.Arrays;

public class Particle {
	public Double[] position;
	public double fitness;
	public Double[] velocity;
	public Double[] bestPosition;
	public double bestFitness;
	
	public Particle (Double[] pos, double fit, Double[] vel, Double[] bestPos, double bestFit) {
		position = Arrays.copyOf(pos, pos.length);
		fitness = fit;
		velocity = Arrays.copyOf(vel, vel.length);
		bestPosition = Arrays.copyOf(bestPos, bestPos.length);
		bestFitness = bestFit;
	}
	
	public Double[] getPosition() {
		return position;
	}

	public void setPosition(Double[] position) {
		this.position = Arrays.copyOf(position, position.length);
	}

	public double getFitness() {
		return fitness;
	}

	public void setFitness(double fitness) {
		this.fitness = fitness;
	}

	public Double[] getVelocity() {
		return velocity;
	}

	public void setVelocity(Double[] velocity) {
		this.velocity = Arrays.copyOf(velocity, velocity.length);
	}

	public Double[] getBestPosition() {
		return bestPosition;
	}

	public void setBestPosition(Double[] bestPosition) {
		this.bestPosition = Arrays.copyOf(bestPosition, bestPosition.length);
	}

	public double getBestFitness() {
		return bestFitness;
	}

	public void setBestFitness(double bestFitness) {
		this.bestFitness = bestFitness;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder();
		sb.append("==========================\n");
		sb.append("Position: ");
		sb.append(Arrays.toString(position));
		sb.append("\n");
		sb.append("Velocity: " + Arrays.toString(velocity) + "\n");
		sb.append("Best Position: " + Arrays.toString(bestPosition) + '\n');
		sb.append("Best Fitness: " + bestFitness + "\n");
		sb.append("==========================\n");
		return sb.toString();
	}
}
